package cn.itcast.bos.dao.base;

import cn.itcast.bos.domain.base.Area;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface AreaRespository extends JpaRepository<Area,String> ,JpaSpecificationExecutor<Area>{
    @Query("select distinct province from Area")
    List<String> findProvince();

    List<Area> findByProvinceAndCityAndDistrict(String province, String city, String district);

    @Query("select distinct city from Area where province=?1")
    List<String> findCity(String province);

    @Query("select district from Area where province=?1 and city=?2")
    List<String> findDistrict(String province, String city);
}
